package com.dd.shop4j.common.utils.security;

import org.apache.shiro.authc.UsernamePasswordToken;

import com.dd.shop4j.common.utils.EncryptUtils;

/**
 * 用户登录认证令牌
 * @author tangshu
 *
 */
public class UserToken extends UsernamePasswordToken {

	private static final long serialVersionUID = -305338337148963097L;
	
	private UserType userType;		//用户类型
	
	public UserToken() {
		super();
	}

	public UserToken(String username, String password, UserType userType) {
		super(username, password);
		this.userType = userType;
	}
	
	public UserToken(String username, String password, boolean rememberMe, UserType userType) {
		super(username, password, rememberMe);
		this.userType = userType;
	}
	
	/**
	 * 获取MD5加密后的密码
	 * @return
	 */
	public String getMD5Password() {
		return EncryptUtils.encrypt(String.valueOf(getPassword()));
	}
	
	public UserType getUserType() {
		return userType;
	}
	
	public void setUserType(UserType userType) {
		this.userType = userType;
	}
}
